﻿using ToDo.Shared;
using ToDo.Shared.Models;

namespace ToDoDemo.Service
{
    public class ToDoService : BaseService<DailyDto>, IToDoService
    {
        private readonly HttpRestClient client;

        public ToDoService(HttpRestClient client) : base(client, "ToDo")
        {
            this.client = client;
        }

        public async Task<ApiResponse<PagedList<DailyDto>>> GetAllFilterAsync(Page parameter)
        {
            BaseRequest request = new BaseRequest();
            request.Method = RestSharp.Method.Get;
            request.Route = $"api/ToDo/GetAll?pageIndex={parameter.PageIndex}" +
                $"&pageSize={parameter.PageSize}";
            return await client.ExecuteAsync<PagedList<DailyDto>>(request);
        }

    }
}
